const app = getApp()
import {
  fetch
} from "./ajax"

// 登录
function reqLogin(params) {
  return fetch({
    url: app.globalData.reqUrl + 'user/login',
    data: params,
    method: 'POST',
    load: 0
  })
}
// 微信登录
function reqWxLogin(params) {
  return fetch({
    url: app.globalData.reqUrl + 'wx/login',
    data: params,
    method: 'POST',
    load: 0
  })
}
// 验证码登录
function reqSmsLogin(params) {
  return fetch({
    url: app.globalData.reqUrl + 'user/smsLogin',
    data: params,
    method: 'POST',
    load: 0
  })
}

// 更新小程序登录信息
function reqSetWXUserInfo(params) {
  return fetch({
    url: app.globalData.reqUrl + 'wxLog/setWXUserInfo',
    data: params,
    method: 'POST',
    load: 0
  })
}
// 记录小程序账号登录
function reqSaveWxLog(params) {
  return fetch({
    url: app.globalData.reqUrl + 'wxLog/saveWxLog',
    data: params,
    method: 'POST',
    load: 0
  })
}
// 查询用户信息
function reqUserInfo(id) {
  return fetch({
    url: app.globalData.reqUrl + `user/getUserInfo/${id}`,
    method: 'GET',
    load: 1
  })
}
// 短信验证码
function reqSmsCode(params) {
  return fetch({
    url: app.globalData.reqUrl + 'smsCode/getSmsCode',
    data: params,
    method: 'POST',
    load: 1
  })
}
// 注册
function reqRegister(params) {
  return fetch({
    url: app.globalData.reqUrl + 'user/register',
    data: params,
    method: 'POST',
    load: 1
  })
}

// 忘记密码
function reqForgetPwd(params) {
  return fetch({
    url: app.globalData.reqUrl + 'user/forgot',
    data: params,
    method: 'PUT',
    load: 1
  })
}
// 重置密码
function reqResetPwd(params) {
  return fetch({
    url: app.globalData.reqUrl + 'user/reset',
    data: params,
    method: 'PUT',
    load: 1
  })
}

// 修改用户信息
function reqUpdateUser(params) {
  return fetch({
    url: app.globalData.reqUrl + `user/updateUser`,
    data: params,
    method: 'PUT',
    load: 1
  })
}
// 获取微信小程序用户信息
function reqWxUserInfo(params) {
  return fetch({
    url: app.globalData.reqUrl + `wx/session`,
    data: params,
    method: 'POST',
  })
}


// 绑定微信
function reqBindWx(params) {
  return fetch({
    url: app.globalData.reqUrl + `wx/bindUser`,
    data: params,
    method: 'PUT',
  })
}

// 解绑微信
function reqUnBindWx(params) {
  return fetch({
    url: app.globalData.reqUrl + `wx/unBindUser`,
    data: params,
    method: 'PUT',
  })
}

// 获取微信手机号
// function reqWxPhone(data) {
//     return fetch({
//         url: app.globalData.reqUrl + `wx/getPhoneNum`,
//         data: data,
//         method: 'POST',
//         load: 1
//     })
// }

// 校验验证码是否通过
function reqCheckCode(params) {
  return fetch({
    url: app.globalData.reqUrl + `user/getCheckCode`,
    data: params,
    method: 'POST',
    load: 0
  })
}

// 校验账号密码
function reqCheckUsername(params) {
  return fetch({
    url: app.globalData.reqUrl + `user/checkUsername`,
    data: params,
    method: 'POST',
    load: 0
  })
}

// 更换手机号
function reqBindMobile(params) {
  return fetch({
    url: app.globalData.reqUrl + `user/changeMobile`,
    data: params,
    method: 'PUT',
  })
}
// 解绑手机
function reqUnBindMobile(params) {
  return fetch({
    url: app.globalData.reqUrl + `user/unBindMobile`,
    data: params,
    method: 'PUT',
  })
}

// 文件上传
function reqfileUpload(file) {
  return fetch({
    url: app.globalData.reqUrl + `file/upload`,
    data: file,
    method: 'POST',
    load: 1
  })
}

// 退出登录
function reqLogout(data) {
  return fetch({
    url: app.globalData.reqUrl + `user/logout`,
    data: data,
    method: 'POST',
    load: 1
  })
}

// 空间列表
function reqSpaceDefence(data) {
  return fetch({
    url: app.globalData.reqUrl + `space/defence`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 空间布防
function reqSpaceList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `space/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}


// 安装点照片
function reqSpaceImage(id) {
  return fetch({
    url: app.globalData.reqUrl + `space/getPicBySpaceId/${id}`,
    method: 'GET',
    load: 1
  })
}

// 单位下空间统计
function reqSpaceStatistics(data) {
  return fetch({
    url: app.globalData.reqUrl + `space/statistics`,
    data,
    method: 'POST',
    load: 0
  })
}

// 新增空间
function reqSpaceAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `space/add`,
    data,
    method: 'POST',
    load: 1
  })
}

// 批量新增空间
function reqSpaceBatchAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `space/batchAdd`,
    data,
    method: 'POST',
    load: 1
  })
}

// 修改空间
function reqSpaceEdit(data) {
  return fetch({
    url: app.globalData.reqUrl + `space/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 删除空间
function reqSpaceDel(data) {
  return fetch({
    url: app.globalData.reqUrl + `space/del`,
    data,
    method: 'POST',
    load: 1
  })
}

// 设备统计
function reqDeviceStatistics(data) {
  return fetch({
    url: app.globalData.reqUrl + `device/statistics`,
    data,
    method: 'POST',
    load: 1
  })
}

// 设备列表
function reqDeviceList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `device/devicePage/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 根据imei查询设备
function reqDeviceByImei(imei) {
  return fetch({
    url: app.globalData.reqUrl + `device/deviceByImei/${imei}`,
    method: 'GET',
    load: 1
  })
}

// 根据空间id查询设备
function reqDeviceBySpaceId(id) {
  return fetch({
    url: app.globalData.reqUrl + `device/deviceBySpaceId/${id}`,
    method: 'GET',
    load: 1
  })
}

// 安装设备
function reqDeviceAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `device/deviceBind`,
    data,
    method: 'POST',
    load: 1
  })
}

// 空间增加接警人--- 安装设备
function reqReceiverSpaceAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `spaceReceiver/addReceiver`,
    data,
    method: 'POST',
    load: 1
  })
}

// 解绑设备
function reqDeviceUnBind(data) {
  return fetch({
    url: app.globalData.reqUrl + `device/deviceUnBind`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 产品列表
function reqProductList() {
  return fetch({
    url: app.globalData.reqUrl + `product/list`,
    method: 'GET',
  })
}

// 产品型号
function reqProductModel(data, page = 1, limit = 99) {
  return fetch({
    url: app.globalData.reqUrl + `productModel/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 开关门记录
function reqDoorList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `doorLog/doorLogPage/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 红外活动记录
function reqInfraredList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `infraredDetection/infraredDetectionPage/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}


// 空间id获取接警人列表
function reqAlarmReceiverBySpaceId(id) {
  return fetch({
    url: app.globalData.reqUrl + `alarmReceiver/getByTargetId/${id}`,
    method: 'GET',
    load: 1
  })
}

// 接警人列表
function reqAlarmReceiverList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `alarmReceiver/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 新增接警人
function reqalarmReveiverAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `alarmReceiver/add`,
    data,
    method: 'POST',
    load: 1
  })
}

// 编辑接警人
function reqalarmReveiverEdit(data) {
  return fetch({
    url: app.globalData.reqUrl + `alarmReceiver/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 删除接警人
function reqalarmReveiverDel(id) {
  return fetch({
    url: app.globalData.reqUrl + `alarmReceiver/del/${id}`,
    method: 'DELETE',
    load: 1
  })
}

// 接警人空间分页
function reqSpaceReceiverList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `spaceReceiver/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 接警人增加空间   --- 接警人详情
function reqSpaceReceiverAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `spaceReceiver/add`,
    data,
    method: 'POST',
    load: 1
  })
}

// 接警人空间批量删除
function reqSpaceReceiverBatchDel(data) {
  return fetch({
    url: app.globalData.reqUrl + `spaceReceiver/batchDel`,
    data,
    method: 'POST',
    load: 1
  })
}

// 空间id查询隔离人
function reqIsolationPerson(id) {
  return fetch({
    url: app.globalData.reqUrl + `isolationPerson/get/${id}`,
    method: 'GET',
  })
}

// 隔离人统计
function reqIsolationPersonStatistics(id) {
  return fetch({
    url: app.globalData.reqUrl + `isolationPerson/statistics/${id}`,
    method: 'GET',
  })
}

// 隔离人列表
function reqIsolationPersonList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `isolationPerson/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 新增隔离人
function reqisolationPersonAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `isolationPerson/add`,
    data,
    method: 'POST',
    load: 1
  })
}

// 编辑隔离人
function reqisolationPersonEdit(data) {
  return fetch({
    url: app.globalData.reqUrl + `isolationPerson/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 解除隔离人
function reqisolationPersonRelieve(id) {
  return fetch({
    url: app.globalData.reqUrl + `isolationPerson/relieve/${id}`,
    method: 'PUT',
    load: 1
  })
}

// 删除隔离人
function reqisolationPersonDel(id) {
  return fetch({
    url: app.globalData.reqUrl + `isolationPerson/del/${id}`,
    method: 'DELETE',
    load: 1
  })
}

// 园区列表
function reqParkList(page, limit = 20, data) {
  return fetch({
    url: app.globalData.reqUrl + `park/page/${page}/${limit}`,
    data,
    method: 'POST',
  })
}

// 告警列表
function reqAlarmList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `alarm/alarmPage/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

//单位未处理告警数量
function reqUntreatedAlarm(data) {
  return fetch({
    url: app.globalData.reqUrl + `alarm/untreatedAlarm`,
    data,
    method: 'POST',
  })
}

// 告警处理
function reqAlarmHandling(data) {
  return fetch({
    url: app.globalData.reqUrl + `alarm/alarmHandling`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 告警处理记录
function reqAlarmHandlingRecord(id) {
  return fetch({
    url: app.globalData.reqUrl + `alarm/getAlarmHandling/${id}`,
    method: 'GET',
    load: 0
  })
}

// 告警闭环
function reqAlarmCloseLoop(data) {
  return fetch({
    url: app.globalData.reqUrl + `alarm/closedLoop`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 单位分页
function reqOrgList(data) {
  return fetch({
    url: app.globalData.reqUrl + `org/orgList`,
    data,
    method: 'POST',
    load: 1
  })
}

// 单位用户分页（团队列表）
function reqOrgUserList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `org/orgUserPage/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 搜索成员
function reqGetAdmin(data) {
  return fetch({
    url: app.globalData.reqUrl + `org/getAdmin`,
    data,
    method: 'POST',
    load: 1
  })
}

// 邀请成员
function reqOrgUserAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `org/orgAddUser`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 删除成员
function reqOrgUserDel(data) {
  return fetch({
    url: app.globalData.reqUrl + `org/orgRemoveUser`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 申请加入单位
function reqOrgApprovalAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `orgApproval/add`,
    data,
    method: 'POST',
    load: 1
  })
}

// 单位成员审批列表分页
function reqOrgApprovalList(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `orgApproval/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 审批操作
function reqOrgApprovalEdit(data) {
  return fetch({
    url: app.globalData.reqUrl + `orgApproval/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 创建组织
function reqOrgAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `org/addOrg`,
    data,
    method: 'POST',
    load: 1
  })
}

// 组织人数
function reqOrgCount(id) {
  return fetch({
    url: app.globalData.reqUrl + `org/memberCount/${id}`,
    method: 'GET',
    load: 1
  })
}
// 移交管理权限
function reqOrgTurnOver(data) {
  return fetch({
    url: app.globalData.reqUrl + `org/turnOver`,
    data,
    method: 'POST',
    load: 1
  })
}

// 退出团队
function reqOrgExit(data) {
  return fetch({
    url: app.globalData.reqUrl + `org/orgExit`,
    data,
    method: 'POST',
    load: 1
  })
}


// 查询省级行政单位
function reqRegion() {
  return fetch({
    url: app.globalData.reqUrl + `analysisRegion/analysisRegion`,
    method: 'GET',
    load: 0
  })
}

// 查询下级行政单位
function reqRegionLevel(id) {
  return fetch({
    url: app.globalData.reqUrl + `analysisRegion/analysisRegionByPCode/${id}`,
    method: 'GET',
    load: 0
  })
}

// 十二、获取微信手机号
function reqGetPhoneNum(data) {
  return fetch({
    url: app.globalData.reqUrl + `wx/getPhoneNum`,
    data,
    method: 'POST',
    load: 1
  })
}

// 七十四、下发指令
function reqCommand(data) {
  return fetch({
    url: app.globalData.reqUrl + `command/add`,
    data,
    method: 'POST',
    load: 1
  })
}

// 七十五、门磁告警模式开关
function reqBatchDoorSwitch(data) {
  return fetch({
    url: app.globalData.reqUrl + `device/batchDoorSwitch`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 七十七、安装点id查询设备组
function reqGetBySpaceId(id) {
  return fetch({
    url: app.globalData.reqUrl + `deviceGroup/getBySpaceId/${id}`,
    method: 'GET',
    load: 0
  })
}

// 七十八、新增设备组
function reqDeviceGroupadd(data) {
  return fetch({
    url: app.globalData.reqUrl + `deviceGroup/add`,
    data,
    method: 'POST',
    load: 1
  })
}

// 七十九、更新设备组
function reqdeviceGroupupdate(data) {
  return fetch({
    url: app.globalData.reqUrl + `deviceGroup/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 删除设备组
function reqdeviceGroupremove(id) {
  return fetch({
    url: app.globalData.reqUrl + `deviceGroup/remove/${id}`,
    method: 'DELETE',
    load: 1
  })
}

// 获取摄像头账号密码
function reqCameraGet() {
  return fetch({
    url: app.globalData.reqUrl + `camera/get`,
    method: 'GET',
    load: 0
  })
}

// 摄像头账号登录
function reqCameralogin(data) {
  return fetch({
    url: app.globalData.reqUrl + `camera/login`,
    data,
    method: 'POST',
    load: 1
  })
}

// 获取组织列表
function reqCameradeptList(data) {
  return fetch({
    url: app.globalData.reqUrl + `camera/deptList`,
    data,
    method: 'POST',
    load: 1
  })
}

// 获取设备列表
function reqCamerdeviceList(data) {
  return fetch({
    url: app.globalData.reqUrl + `camera/deviceList`,
    data,
    method: 'POST',
    load: 1
  })
}

// 获取设备播放url地址
function reqCamerurl(data) {
  return fetch({
    url: app.globalData.reqUrl + `camera/url`,
    data,
    method: 'POST',
    load: 1
  })
}

// 修改设备标点
function reqUpdateMark(data) {
  return fetch({
    url: app.globalData.reqUrl + `device/updateMark`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 安装点id查询平面图
function reqFloorById(id) {
  return fetch({
    url: app.globalData.reqUrl + `space/floorById/${id}`,
    method: 'GET',
    load: 0
  })
}

// 安装点id查询建筑物
function reqBuildingById(id) {
  return fetch({
    url: app.globalData.reqUrl + `space/buildingById/${id}`,
    method: 'GET',
    load: 0
  })
}

// 隐患上报
function reqAddDanger(params) {
  return fetch({
    url: app.globalData.reqUrl + `audit/add`,
    data: params,
    method: 'POST',
    load: 1
  })
}

// 隐患节点统计
function reqStatistics(params) {
  return fetch({
    url: app.globalData.reqUrl + `audit/statistics`,
    data: params,
    method: 'POST',
    load: 0
  })
}

// 隐患列表
function reqDangerList(page, data) {
  return fetch({
    url: app.globalData.reqUrl + `audit/page/${page}/10`,
    data,
    method: 'POST',
    load: 1
  })
}

// 处理隐患记录
function reqAuditDetails(id) {
  return fetch({
    url: app.globalData.reqUrl + `audit/getAuditDetails/${id}`,
    method: 'GET',
    load: 0
  })
}

// 处理隐患
function reqUpdateDanger(params) {
  return fetch({
    url: app.globalData.reqUrl + `audit/update`,
    data: params,
    method: 'PUT',
    load: 0
  })
}

// 查询接警人接警时段
function reqReceiverTimeget(receiverId) {
  return fetch({
    url: app.globalData.reqUrl + `receiverTime/getByReceiverId/${receiverId}`,
    method: 'GET',
    load: 0
  })
}

// 修改/批量修改接警时段
function reqReceiverTimeupdate(params) {
  return fetch({
    url: app.globalData.reqUrl + `receiverTime/update`,
    data: params,
    method: 'PUT',
    load: 0
  })
}

// 设备查询撤防时段
function reqGetByDeviceId(deviceId) {
  return fetch({
    url: app.globalData.reqUrl + `defence/getByDeviceId/${deviceId}`,
    method: 'GET',
    load: 0
  })
}

// 修改设备撤防时段
function reqDefenceupdate(params) {
  return fetch({
    url: app.globalData.reqUrl + `defence/update`,
    data: params,
    method: 'PUT',
    load: 0
  })
}

// 维保组列表分页
function reqMaintenancepage(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `maintenance/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 查询维保组技工
function reqMaintenanceget(id) {
  return fetch({
    url: app.globalData.reqUrl + `maintenance/get/${id}`,
    method: 'GET',
    load: 0
  })
}

// 新增隐患
function reqhiddenDangerAdd(params) {
  return fetch({
    url: app.globalData.reqUrl + `hiddenDanger/add`,
    data: params,
    method: 'POST',
    load: 1
  })
}

// 隐患列表
function reqhiddenDangerpage(page, data) {
  return fetch({
    url: app.globalData.reqUrl + `hiddenDanger/page/${page}/10`,
    data,
    method: 'POST',
    load: 1
  })
}

// 获取隐患信息
function reqhiddenDangerget(id) {
  return fetch({
    url: app.globalData.reqUrl + `hiddenDanger/get/${id}`,
    method: 'GET',
    load: 0
  })
}

// 处理隐患
function reqhiddenDangerupdate(params) {
  return fetch({
    url: app.globalData.reqUrl + `hiddenDanger/update`,
    data: params,
    method: 'PUT',
    load: 0
  })
}

// 工单列表
function reqworkOrderpage(page, data) {
  return fetch({
    url: app.globalData.reqUrl + `workOrder/page/${page}/10`,
    data,
    method: 'POST',
    load: 1
  })
}

// 工单id获取工单处理记录
function reqworkOrderLog(id) {
  return fetch({
    url: app.globalData.reqUrl + `workOrder/workOrderLog/${id}`,
    method: 'GET',
    load: 0
  })
}

// 隐患id获取工单信息及处理记录
function reqbyHiddenDangerId(hiddenDangerId) {
  return fetch({
    url: app.globalData.reqUrl + `workOrder/byHiddenDangerId/${hiddenDangerId}`,
    method: 'GET',
    load: 0
  })
}

// 处理工单
function reqworkOrderupdate(params) {
  return fetch({
    url: app.globalData.reqUrl + `workOrder/update`,
    data: params,
    method: 'PUT',
    load: 1
  })
}

//单位未处理隐患数量
function reqHiddenDanger(data) {
  return fetch({
    url: app.globalData.reqUrl + `hiddenDanger/untreated`,
    data,
    method: 'POST',
  })
}

//单位未处理工单数量
function reqWorkOrder(data) {
  return fetch({
    url: app.globalData.reqUrl + `workOrder/untreated`,
    data,
    method: 'POST',
  })
}

// imei查询告警视频列表
function reqPlayList(page, imei) {
  return fetch({
    url: app.globalData.reqUrl + `camera/playList/${page}/10/${imei}`,
    method: 'GET',
    load: 1
  })
}

// 告警id查询告警视频列表
function reqAlarmPlay(alarmId) {
  return fetch({
    url: app.globalData.reqUrl + `camera/alarmPlay/${alarmId}`,
    method: 'GET',
    load: 0
  })
}

// 用户解绑设备
function reqDeviceUserunBind(id) {
  return fetch({
    url: app.globalData.reqUrl + `deviceUser/unBind/${id}`,
    method: 'PUT',
    load: 1
  })
}

//业主绑定设备
function reqDeviceUserbind(data) {
  return fetch({
    url: app.globalData.reqUrl + `deviceUser/bind`,
    data,
    method: 'POST',
  })
}

// 业主设备列表
function reqDeviceUserpage(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `deviceUser/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 设备查询设备用户
function reqDeviceUsergetByImei(imei) {
  return fetch({
    url: app.globalData.reqUrl + `deviceUser/getByImei/${imei}`,
    method: 'GET',
    load: 1
  })
}

// 预新增业主账号
function reqAddNormalUser(params) {
  return fetch({
    url: app.globalData.reqUrl + `user/addNormalUser`,
    data: params,
    method: 'POST',
    load: 1
  })
}

// 查询业主账号
function reqGetNormalUser(params) {
  return fetch({
    url: app.globalData.reqUrl + `user/getNormalUser`,
    data: params,
    method: 'POST',
    load: 1
  })
}

// 查询imei信息
function reqGetDeviceByImei(imei) {
  return fetch({
    url: app.globalData.reqUrl + `deviceUser/getDeviceByImei/${imei}`,
    method: 'GET',
    load: 1
  })
}

// imei查询最新设备数据
function reqDeviceData(imei) {
  return fetch({
    url: app.globalData.reqUrl + `deviceData/get/${imei}`,
    method: 'GET',
    load: 1
  })
}

// 设备数据统计
function reqDeviceDatastatistic(params) {
  return fetch({
    url: app.globalData.reqUrl + `deviceData/statistic`,
    data: params,
    method: 'POST',
    load: 1
  })
}

// 指令服务分页
function reqCommandService(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `commandService/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 更换设备
function reqDeviceReplace(data) {
  return fetch({
    url: app.globalData.reqUrl + `device/deviceReplace`,
    data,
    method: 'POST',
    load: 1
  })
}

// 更换设备确定
function reqCheckReplace(data) {
  return fetch({
    url: app.globalData.reqUrl + `device/checkReplace`,
    data,
    method: 'POST',
    load: 1
  })
}

// 获取电气综合测控装置详情
function reqDeviceFindInfo(id) {
  return fetch({
    url: app.globalData.reqUrl + `device/findInfoByDeviceId/${id}`,
    method: 'POST',
    load: 1
  })
}

// 获取短信包剩余额度
function reqMessagePackage(orgId) {
  return fetch({
    url: app.globalData.reqUrl + `messagePackage/messagePackage/${orgId}`,
    method: 'GET',
    load: 1
  })
}

// 获取语音包剩余额度
function reqVoicePackage(orgId) {
  return fetch({
    url: app.globalData.reqUrl + `voicePackage/voicePackage/${orgId}`,
    method: 'GET',
    load: 1
  })
}

// 账号注销
function reqUserCancel() {
  return fetch({
    url: app.globalData.reqUrl + `user/cancel`,
    method: 'DELETE',
    load: 1
  })
}

// 注册家庭用户账号
function reqConsumerRegister(params) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/user/register`,
    data: params,
    method: 'POST',
    load: 1
  })
}

// 家庭 新增
function reqConsumerHomeAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/home/add`,
    data,
    method: 'POST',
    load: 1
  })
}


// 家庭 列表
function reqConsumerHomeList(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/home/list`,
    data,
    method: 'POST',
    load: 0
  })
}

// 家庭 编辑
function reqConsumerHomeUpdate(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/home/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 家庭 删除
function reqConsumerHomeDel(homeId) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/home/del/${homeId}`,
    method: 'DELETE',
    load: 1
  })
}

// 家庭用户列表
function reqConsumerList(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/homeConsumer/consumerList`,
    data,
    method: 'POST',
    load: 1
  })
}

// 获取预加入id
function reqGetPreId(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/homeConsumer/getPreId`,
    data,
    method: 'POST',
    load: 1
  })
}

// 邀请结果
function reqApprove(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/homeConsumer/approve`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 退出家庭
function reqExit(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/homeConsumer/exit`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 移除成员
function reqRemove(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/homeConsumer/remove`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 修改家庭用户信息
function reqUpdate(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/homeConsumer/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 房间 新增
function reqConsumerRoomAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/room/add`,
    data,
    method: 'POST',
    load: 1
  })
}


// 房间 列表
function reqConsumerRoomList(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/room/list`,
    data,
    method: 'POST',
    load: 1
  })
}

// 房间 编辑
function reqConsumerRoomUpdate(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/room/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 房间 删除
function reqConsumerRoomDel(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/room/batchDel`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 房间 排序
function reqConsumerRoomSort(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/room/sort`,
    data,
    method: 'PUT',
    load: 1
  })
}


// 设备 新增
function reqConsumerDeviceAdd(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/device/add`,
    data,
    method: 'POST',
    load: 1
  })
}


// 设备 列表
function reqConsumerDeviceList(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/device/list`,
    data,
    method: 'POST',
    load: 1
  })
}

// 设备 编辑
function reqConsumerDeviceUpdate(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/device/update`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 设备 删除
function reqConsumerDeviceBatchDel(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/device/batchDel`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 设备 移动设备
function reqConsumerDeviceMove(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/device/move`,
    data,
    method: 'PUT',
    load: 1
  })
}

// 设备 下发消音指令
function reqConsumerDeviceMuffling(data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/device/muffling`,
    data,
    method: 'POST',
    load: 1
  })
}

// 根据openId查询用户订阅列表
function reqUserSubscribeByParam(params) {
  return fetch({
    url: app.globalData.reqUrl + `wx/getUserSubscribeByParam`,
    data: params,
    method: 'POST',
    load: 0
  })
}

// 告警列表
function reqConsumerAlarmPage(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `consumer/alarm/page/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 未读消息数量
function reqGetUnReadNoticeCount( data) {
  return fetch({
    url: app.globalData.reqUrl + `notice/getUnReadNoticeCount`,
    data,
    method: 'POST',
    load: 1
  })
}

// 首页最新消息
function reqGetIndexNotice( data) {
  return fetch({
    url: app.globalData.reqUrl + `notice/getIndexNotice`,
    data,
    method: 'POST',
    load: 1
  })
}

// 消息列表
function reqGetNoticeListByType(page, limit = 10, data) {
  return fetch({
    url: app.globalData.reqUrl + `notice/getNoticeListByType/${page}/${limit}`,
    data,
    method: 'POST',
    load: 1
  })
}

// 消息已读
function reqUpdateNoticeStatus(noticeId) {
  return fetch({
    url: app.globalData.reqUrl + `notice/updateNoticeStatus/${noticeId}`,
    method: 'POST',
    load: 1
  })
}

// 批量消息已读
function reqUpdateNoticeStatusByParam(data) {
  return fetch({
    url: app.globalData.reqUrl + `notice/updateNoticeStatusByParam`,
    data,
    method: 'POST',
    load: 1
  })
}

// 检验用户是否订阅所有通知
function reqCheckUserSubscribe( data) {
  return fetch({
    url: app.globalData.reqUrl + `notice/checkUserSubscribe`,
    data,
    method: 'POST',
    load: 1
  })
}

// 用户订阅消息配置
function reqUserSubscribe( data) {
  return fetch({
    url: app.globalData.reqUrl + `wx/userSubscribe`,
    data,
    method: 'POST',
    load: 1
  })
}

// 根据字典类型查询字典数据信息
function getDicts(dictType) {
  return fetch({
    url: app.globalData.reqUrl + `dictData/getByType/${dictType}`,
    method: 'GET',
    load: 1
  })
}

module.exports = {
  getDicts,
  reqUpdate,
  reqRemove,
  reqApprove,
  reqGetPreId,
  reqConsumerList,
  reqExit,
  reqUserSubscribe,
  reqCheckUserSubscribe,
  reqUpdateNoticeStatusByParam,
  reqUpdateNoticeStatus,
  reqGetNoticeListByType,
  reqGetIndexNotice,
  reqGetUnReadNoticeCount,
  reqUserSubscribeByParam,
  reqConsumerDeviceMove,
  reqConsumerAlarmPage,
  reqConsumerDeviceMuffling,
  reqConsumerDeviceBatchDel,
  reqConsumerDeviceUpdate,
  reqConsumerDeviceList,
  reqConsumerDeviceAdd,
  reqConsumerRoomSort,
  reqConsumerRoomDel,
  reqConsumerRoomUpdate,
  reqConsumerRoomList,
  reqConsumerRoomAdd,
  reqConsumerHomeDel,
  reqConsumerHomeUpdate,
  reqConsumerHomeList,
  reqConsumerHomeAdd,
  reqConsumerRegister,
  reqUserCancel,
  reqVoicePackage,
  reqMessagePackage,
  reqDeviceFindInfo,
  reqCheckReplace,
  reqDeviceReplace,
  reqCommandService,
  reqDeviceDatastatistic,
  reqGetNormalUser,
  reqGetDeviceByImei,
  reqDeviceData,
  reqAddNormalUser,
  reqDeviceUserunBind,
  reqDeviceUsergetByImei,
  reqDeviceUserpage,
  reqDeviceUserbind,
  reqAlarmPlay,
  reqPlayList,
  reqWorkOrder,
  reqHiddenDanger,
  reqworkOrderupdate,
  reqbyHiddenDangerId,
  reqMaintenancepage,
  reqMaintenanceget,
  reqhiddenDangerAdd,
  reqhiddenDangerpage,
  reqhiddenDangerget,
  reqhiddenDangerupdate,
  reqworkOrderLog,
  reqworkOrderpage,
  reqLogin,
  reqWxLogin,
  reqSmsLogin,
  reqSetWXUserInfo,
  reqSaveWxLog,
  reqUserInfo,
  reqSmsCode,
  reqRegister,
  reqForgetPwd,
  reqResetPwd,
  reqUpdateUser,
  reqWxUserInfo,
  reqBindWx,
  reqUnBindWx,
  // reqWxPhone,
  reqBindMobile,
  reqUnBindMobile,
  reqfileUpload,
  reqLogout,
  reqParkList,
  reqSpaceList,
  reqSpaceDefence,
  reqSpaceStatistics,
  reqSpaceImage,
  reqSpaceAdd,
  reqSpaceBatchAdd,
  reqSpaceEdit,
  reqSpaceDel,

  reqDeviceStatistics,
  reqDeviceList,
  reqDeviceByImei,
  reqDeviceBySpaceId,
  reqDeviceAdd,
  reqReceiverSpaceAdd,
  reqDeviceUnBind,
  reqProductList,
  reqProductModel,
  reqDoorList,
  reqInfraredList,

  reqAlarmReceiverBySpaceId,
  reqAlarmReceiverList,
  reqalarmReveiverAdd,
  reqalarmReveiverEdit,
  reqalarmReveiverDel,
  reqSpaceReceiverList,
  reqSpaceReceiverAdd,
  reqSpaceReceiverBatchDel,

  reqIsolationPerson,
  reqIsolationPersonStatistics,
  reqIsolationPersonList,
  reqisolationPersonAdd,
  reqisolationPersonEdit,
  reqisolationPersonRelieve,
  reqisolationPersonDel,

  reqAlarmList,
  reqUntreatedAlarm,
  reqAlarmHandling,
  reqAlarmHandlingRecord,
  reqAlarmCloseLoop,

  reqOrgList,
  reqOrgUserList,
  reqGetAdmin,
  reqOrgUserAdd,
  reqOrgUserDel,
  reqOrgApprovalAdd,
  reqOrgApprovalList,
  reqOrgApprovalEdit,
  reqOrgAdd,
  reqOrgCount,
  reqOrgTurnOver,
  reqOrgExit,

  reqRegion,
  reqRegionLevel,
  reqGetPhoneNum,
  reqCommand,
  reqBatchDoorSwitch,
  reqdeviceGroupremove,
  reqdeviceGroupupdate,
  reqDeviceGroupadd,
  reqGetBySpaceId,
  reqCamerurl,
  reqCamerdeviceList,
  reqCameradeptList,
  reqCameralogin,
  reqCameraGet,
  reqUpdateMark,
  reqFloorById,
  reqBuildingById,
  reqCheckCode,
  reqCheckUsername,
  reqAddDanger,
  reqStatistics,
  reqDangerList,
  reqAuditDetails,
  reqUpdateDanger,
  reqReceiverTimeget,
  reqReceiverTimeupdate,
  reqGetByDeviceId,
  reqDefenceupdate
}